package com.funo.wcity.app.dao;

import java.sql.SQLException;
import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateCallback;
import org.springframework.stereotype.Repository;

@Repository("loginUserDAO")
public class LoginUserDAO extends DefaultBaseDao{
    
	public List getLoginUser(final String username,final String password) {
		return this.hibernateTemplate.executeFind(new HibernateCallback(){
			public List doInHibernate(Session session) throws HibernateException,SQLException {
				String hql = "From TblUsers u"+
					" where 1=1 and u.status=0 and u.username=:username and u.password=:password";
				Query query=session.createQuery(hql);
				query.setString("username",username);
				query.setString("password", password);
				return query.list();
			}
		});
	}
}
